In mysql, if I use common data sorting methods, we may not get the expected results, but mysql provides us with the CAST CONVERT function, which can CONVERT numbers accordingly, I used this function to sort Chinese characters in the past.
Let's
Simple to say about MySQL's varchar sorting problem, a cautionary tale.
Sample Table structure:
Let's take a look at my table structure
code is as follows
copy code
Show create table Cardserver G **************
Charvarcharvarchar2 differences: 1. the length of CHAR is fixed, while the length of VARCHAR2 can be changed. For example, the storage string "abc", for CHAR (20 ), it indicates that the characters you store will occupy 20 bytes (including 17 null
Original URL: The difference between char and varchar in http://www.jb51.net/article/23575.htmmysql font: [Increase decrease] type: reprinted in MySQL tutorial the difference between char and varchar, are used to store strings, except that they are
Comparison of data typesChar represents a fixed length, and the longest n-word varchar represents the actual length of the data type, such as: if it is a char type, when you enter a character that is less than the length, then a space is added, but
The difference between char and varchar
char (13) length fixed, such as ' www.jb51.net ' storage requires space 12 characters
varchar (13) variable length as ' www.jb51.net ' requires storage space of 13 characters,
From the above you can see
In the MySQL tutorial, the difference between char and varchar is used to store strings, except that they are saved in a different way, Char has a fixed length, and varchar is a variable-length character type.The difference between char and
String function string comparison function if the result length is greater than the maximum value of the max_allowed_packet system variable, the return value of the string value function is NULL. See section 7.5.2 "Adjust server Parameters ".
String
Generally, the entire string is used as the operation object, for example: search for a substring in a substring, obtain a substring, insert a substring at a certain position in the substring, and delete a substring.
Generally, the entire string is
Generally, the entire string is used as the operation object, for example: search for a substring in a substring, obtain a substring, insert a substring at a certain position in the substring, and delete a substring. The required and sufficient
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.